<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('创业津贴奖励配置列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>代理编号：</label>
                                <input type="text" name="agentNum"/>
                            </li>
                            <li>
                                <label>团队编号：</label>
                                <input type="text" name="teamYlId"/>
                            </li>
                            <li>
                                <label>团长编号：</label>
                                <input type="text" name="parentYlId"/>
                            </li>
                            <li>
                                <label style="width: 80px;">类型：</label>
                                <select name="type">
                                    <option value="">所有</option>
                                    <option value="1">团长</option>
                                    <option value="2">资深总监</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 80px;">状态：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="1">启用</option>
                                    <option value="0">禁用</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add(650,1200)" shiro:hasPermission="team:allowanceAward:add">
                    <i class="fa fa-plus"></i> 新增奖励
                </a>
                <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="team:allowanceAward:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="team:allowanceAward:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="team:allowanceAward:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('team:allowanceAward:edit')}]];
        var removeFlag = [[${@permission.hasPermi('team:allowanceAward:remove')}]];
        var prefix = ctx + "team/allowanceAward";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "创业津贴奖励配置",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'actName',
                    title: '活动名称'
                },
                {
                    field: 'agentNum',
                    title: '代理编号'
                },
                {
                    field: 'agentName',
                    title: '代理名称'
                },
                {
                    field: 'type',
                    title: '类型',
                    formatter:function (value, row, index) {
                        if (value == '1'){
                            return "<span style='color: green'>团长</span>";
                        } else if (value == '2'){
                            return "<span style='color: red'>资深总监</span>";
                        } else {
                            return "未知";
                        }
                    }
                },
                {
                    field: 'teamYlId',
                    title: '团编号'
                },
                {
                    field: 'parentYlId',
                    title: '团长编号'
                },
                {
                    field: 'totalMoney',
                    title: '累计交易量金额'
                },
                {
                    field: 'award',
                    title: '奖励比例'
                },
                {
                    field: 'actStartDate',
                    title: '活动开始时间'
                },
                {
                    field: 'actEndDate',
                    title: '活动结束时间'
                },
                    {
                        field: 'status',
                        title: '活动状态',
                        formatter:function (value, row, index) {
                            if (value == '1'){
                                return "<span style='color: green'>启用</span>";
                            } else if (value == '0'){
                                return "<span style='color: red'>禁用</span>";
                            } else {
                                return "未知";
                            }
                        }
                    },
                    {
                        field: 'addMan',
                        title: '添加人'
                    },
                {
                    field: 'addDate',
                    title: '添加时间'
                },
                {
                    field: 'updateDate',
                    title: '修改时间'
                },
                {
                    field: 'updateMan',
                    title: '修改人'
                },
                {
                    field: 'teamAwardType',
                    title: '团奖励类型',
                    formatter:function (value, row, index) {
                        if (value == '4'){
                            return "<span style='color: green'>电签</span>";
                        } else if (value == '0'){
                            return "<span style='color: blue'>传统</span>";
                        }  else {
                            return "暂无";
                        }
                    }
                },
                {
                    field: 'teamAward',
                    title: '团长奖励比例'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\',620,1200)"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\',620,1200)"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
